/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_context_args.h

	$Header: /heroes4/script_context_args.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef _SCRIPT_CONTEXT_ARGS_HDR
#define _SCRIPT_CONTEXT_ARGS_HDR

class t_adventure_map;
class t_adventure_object;
class t_creature_array;
class t_hero;
class t_owned_adv_object;
class t_player;
class t_town;

#include "adv_map_point.h"

struct t_script_context_hero
{
	t_script_context_hero(t_adventure_map* _map, t_hero* _hero, t_creature_array* _army, 
						  t_player* _army_owner, t_creature_array* _opposing_army = NULL, 
						  t_player* _opposing_army_owner = NULL, 
						  t_adv_map_point const* _location = NULL);

	t_creature_array*		army;
	t_player*				army_owner;
	t_hero*					hero;
	t_adv_map_point			location;
	t_adventure_map*		map;
	t_creature_array*		opposing_army;
	t_player*				opposing_army_owner;
};

struct t_script_context_town
{
	t_script_context_town(t_adventure_map* _map, 
						  t_owned_adv_object* _object, 
						  t_creature_array* _garrison,
						  t_creature_array* _opposing_army = NULL, 
						  t_player* _opposing_army_owner = NULL, 
						  t_adv_map_point const* _location = NULL,
						  t_town* town = NULL);

	t_adv_map_point			location;
	t_adventure_map*		map;
	t_owned_adv_object*		object;
	t_creature_array*		garrison;
	t_creature_array*		opposing_army;
	t_player*				opposing_army_owner;
	t_town*					town;
};

struct t_script_context_object
{
	t_script_context_object(t_adventure_map* _map, t_owned_adv_object* _object);

	t_adventure_map*		map;
	t_owned_adv_object*		object;
};

struct t_script_context_army
{
	t_script_context_army( t_adventure_map* _map, t_creature_array* _army, 
						   t_player* _army_owner, t_creature_array* _opposing_army = NULL, 
						   t_player* _opposing_army_owner = NULL, 
						   t_adv_map_point const* _location = NULL, t_adventure_object* removal_object = NULL );

	t_creature_array*		army;
	t_player*				army_owner;
	t_adv_map_point			location;
	t_adventure_map*		map;
	t_creature_array*		opposing_army;
	t_player*				opposing_army_owner;
	t_adventure_object*		removal_object;
};

struct t_script_context_global
{
	t_script_context_global(t_adventure_map* _map = NULL);

	t_adventure_map*	map;
};

inline t_script_context_hero::t_script_context_hero(t_adventure_map* _map, t_hero* _hero,
													t_creature_array* _army, 
													t_player* _army_owner,
													t_creature_array* _opposing_army, 
													t_player* _opposing_army_owner, 
													t_adv_map_point const* _location) 
	:	map(_map), hero(_hero), army(_army), 
		army_owner(_army_owner), opposing_army(_opposing_army),
		opposing_army_owner(_opposing_army_owner)
{
	if (_location) 
		location = *_location;
}

inline t_script_context_town::t_script_context_town(t_adventure_map* _map, 
														t_owned_adv_object* _object, 
														t_creature_array* _garrison,
														t_creature_array* _opposing_army, 
														t_player* _opposing_army_owner,
														t_adv_map_point const* _location,
														t_town* _town) 
	:	map(_map), object(_object), garrison(_garrison), town(_town), opposing_army(_opposing_army),
		opposing_army_owner(_opposing_army_owner)
{
	if (_location) 
		location = *_location;
}

inline t_script_context_object::t_script_context_object(t_adventure_map* _map, t_owned_adv_object* _object) 
	:	map(_map), object(_object)
{
}

inline t_script_context_army::t_script_context_army(t_adventure_map* _map, t_creature_array* _army, 
														t_player* _army_owner, t_creature_array* _opposing_army, 
														t_player* _opposing_army_owner,
														t_adv_map_point const* _location, t_adventure_object* _removal_object) 
	:	map(_map), army(_army), 
		army_owner(_army_owner), opposing_army(_opposing_army),
		opposing_army_owner(_opposing_army_owner),
		removal_object(_removal_object)
{
	if (_location) 
		location = *_location;
}


inline t_script_context_global::t_script_context_global(t_adventure_map* _map) 
	:	map(_map)
{
}

struct t_expression_context_hero
{
	t_expression_context_hero(t_adventure_map const*	_map, 
							  t_hero const*				_hero, 
							  t_creature_array const*	_army, 
							  t_player const*			_army_owner,
							  t_creature_array const*	_opposing_army = NULL, 
							  t_player const*			_opposing_army_owner = NULL, 
							  t_adv_map_point const*	_location = NULL);

	t_expression_context_hero(t_script_context_hero const& source);

	t_creature_array const*		army;
	t_player const*				army_owner;
	t_hero const*				hero;
	t_adv_map_point				location;
	t_adventure_map const*		map;
	t_creature_array const*		opposing_army;
	t_player const*				opposing_army_owner;
};

struct t_expression_context_town
{
	t_expression_context_town( t_adventure_map const*		_map, 
							   t_owned_adv_object const*	_object, 
							   t_creature_array const*		_garrison,
							   t_creature_array const*		_opposing_army = NULL,
							   t_player const*				_opposing_army_owner = NULL, 
							   t_adv_map_point const*		_location = NULL,
							   t_town const*				_town = NULL);
	t_expression_context_town(t_script_context_town const& source);

	t_creature_array const*		garrison;
	t_adv_map_point				location;
	t_owned_adv_object const*	object;
	t_adventure_map const*		map;
	t_creature_array const*		opposing_army;
	t_player const*				opposing_army_owner;
	t_town const*				town;
};

struct t_expression_context_object
{
	t_expression_context_object(t_adventure_map const* _map, t_owned_adv_object const* _object);

	t_expression_context_object(t_script_context_object const& source);

	t_adventure_map const*		map;
	t_owned_adv_object const*	object;
};

struct t_expression_context_army
{
	t_expression_context_army(t_adventure_map const* _map, t_creature_array const* _army, 
							  t_player const* _army_owner, 
							  t_creature_array const* _opposing_army = NULL,
							  t_player const* _opposing_army_owner = NULL, 
							  t_adv_map_point const* _location = NULL);

	t_expression_context_army(t_script_context_army const& source);

	t_creature_array const*		army;
	t_player const*				army_owner;
	t_adv_map_point				location;
	t_adventure_map const*		map;
	t_creature_array const*		opposing_army;
	t_player const*				opposing_army_owner;
};

struct t_expression_context_global
{
	t_expression_context_global(t_adventure_map const* _map = NULL);
	t_expression_context_global(t_script_context_global const& source);

	t_adventure_map const*	map;
};

inline t_expression_context_hero::t_expression_context_hero(t_adventure_map const* _map, t_hero const* _hero, t_creature_array const* _army, 
														t_player const* _army_owner, t_creature_array const* _opposing_army, 
														t_player const* _opposing_army_owner, 
														t_adv_map_point const* _location) 
	:	map(_map), hero(_hero), army(_army), 
		army_owner(_army_owner), opposing_army(_opposing_army),
		opposing_army_owner(_opposing_army_owner)
{
	if (_location) 
		location = *_location;
}

inline t_expression_context_hero::t_expression_context_hero(t_script_context_hero const& source) 
{
	map = source.map;
	hero = source.hero;
	army = source.army;
	army_owner = source.army_owner;
	opposing_army = source.opposing_army;
	opposing_army_owner = source.opposing_army_owner;
}

inline t_expression_context_town::t_expression_context_town(t_adventure_map const* _map, t_owned_adv_object const* _object, 
														t_creature_array const* _garrison,
														t_creature_array const* _opposing_army, 
														t_player const* _opposing_army_owner,
														t_adv_map_point const* _location,
														t_town const* _town) 
	:	map(_map), town(_town), opposing_army(_opposing_army), garrison(_garrison), object(_object),
		opposing_army_owner(_opposing_army_owner)
{
	if (_location) 
		location = *_location;
}

inline t_expression_context_town::t_expression_context_town(t_script_context_town const& source) 
{
	map = source.map;
	object = source.object;
	garrison = source.garrison;	
	opposing_army = source.opposing_army;
	opposing_army_owner = source.opposing_army_owner;
	town = source.town;
	location = source.location;
}

inline t_expression_context_object::t_expression_context_object(t_adventure_map const* _map, t_owned_adv_object const* _object) 
	:	map(_map), object(_object)
{
}

inline t_expression_context_object::t_expression_context_object(t_script_context_object const& source) 
{
	map = source.map;
	object = source.object;
}

inline t_expression_context_army::t_expression_context_army(t_adventure_map const* _map, t_creature_array const* _army, 
														t_player const* _army_owner, t_creature_array const* _opposing_army, 
														t_player const* _opposing_army_owner,
														t_adv_map_point const* _location) 
	:	map(_map), army(_army), 
		army_owner(_army_owner), opposing_army(_opposing_army),
		opposing_army_owner(_opposing_army_owner)
{
	if (_location) 
		location = *_location;
}

inline t_expression_context_army::t_expression_context_army(t_script_context_army const& source) 
{
	map = source.map;
	army = source.army;
	army_owner = source.army_owner;
	opposing_army = source.opposing_army;
	opposing_army_owner = source.opposing_army_owner;
	location = source.location;
}


inline t_expression_context_global::t_expression_context_global(t_adventure_map const* _map) 
	:	map(_map)
{
}

inline t_expression_context_global::t_expression_context_global(t_script_context_global const& source) 
{
	map = source.map;
}

#endif